package com.example.department.Aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Aspect

public class aop {
    @Around("execution(* com.example.department.service.*.*(..))")
    public Object aop(ProceedingJoinPoint pj) throws Throwable {
        long begin = System.currentTimeMillis();
        Object object = pj.proceed();
        long end = System.currentTimeMillis();

log.info(pj.getSignature()+"所用时间为 {}ms",end-begin);
return object;
    }
}
